<?php
$title=$_POST['title'];
$content=$_POST['content'];
$createtime=time();

//链接数据库
$link=mysqli_connect('localhost','root','');
//设定字符集
mysqli_set_charset($link,'utf8');
//选择数据库
mysqli_select_db($link,'studynote');
//准备sql语句 
$sql="insert into note(title,content,createtime) values('$title','$content',$createtime)";


//执行生气了语句
$res=mysqli_query($link,$sql);
if($res && mysqli_affected_rows($link)>0){
	echo '<script>alert("发表成功")</script>';
	header('location:index.php');
	exit;
}